package com.example.ebel.ticker;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;


public class MatchEntryLayout extends LinearLayout {

	public final Button bScore;
	public final LinearLayout aLL;
	private final TextView tvHeaderDate, tvHeaderMatch, tvMatchAction, tvLastGoal, tvLastAction;
	
	public MatchEntryLayout(Context context, final MatchLayout parent, String header_date, String header_match, String action_match, String goal_last, String action_last, String score)
	{
		super(context);

		//instantiate xml layout
		LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		inflater.inflate(R.layout.matchentry, this);

		tvHeaderMatch = (TextView)this.findViewById(R.id.match_header_match);
		tvHeaderMatch.setText(header_match);
		
		tvHeaderDate = (TextView)this.findViewById(R.id.match_header_date);
		tvHeaderDate.setText(header_date);
		
		tvMatchAction = (TextView)this.findViewById(R.id.match_text_line1);
		tvMatchAction.setText(action_match);
		
		tvLastGoal = (TextView)this.findViewById(R.id.match_text_line2);
		tvLastGoal.setText(goal_last);
		
		tvLastAction = (TextView)this.findViewById(R.id.match_text_line3);
		tvLastAction.setText(action_last);

		aLL = (LinearLayout)this.findViewById(R.id.match_score_all);
						
		bScore = (Button)this.findViewById(R.id.match_score);
		bScore.setText(score);

		aLL.setOnClickListener(new View.OnClickListener() {
       	public void onClick(View v) {

       			Intent myIntent = new Intent(v.getContext(), gotoDetails.class);
                v.getContext().startActivity(myIntent);

            }
        });
	
			
	}

}
